package com.spring.jackson.seckill.constant;

public class CommonConstant {


    public interface RedisKey {

        /**
         * 限流器名字
         */
        String GOODS_STORE_BY_ID = "GOODS_STORE_BY_GOODS_ID_{0}";

        /**
         * 秒杀商品的key GOODS_INFO_BY_GOODS_ID_1，其中最后一个"1"就代表每个商品的id
         */
        String GOODS_INFO_BY_ID = "GOODS_INFO_BY_GOODS_ID_{0}";

        // 秒杀处理列表 MIAOSHA_HANDLE_LIST_GOODS_RANDOM_NAME
        String MIAOSHA_HANDLE_LIST = "MIAOSHA_HANDLE_LIST_GOODS_RANDOM_NAME:{0}";

        // 秒杀结束标志 MIAOSHA_FINISH_FLAG_GOODS_RANDOM_NAME:0e67e331-c521-406a-b705-64e557c4c06c,其中"0e67e331-c521-406a-b705-64e557c4c06c"这个商品的唯一标示
        String MIAOSHA_FINISH_FLAG = "MIAOSHA_FINISH_FLAG_GOODS_RANDOM_NAME:{0}";


        // redis占位成功下单token
        String MIAOSHA_SUCCESS_TOKEN = "MIAOSHA_SUCCESS_TOKEN_MOBILE:{0}_GOODS_RANDOM_NAME:{1}_";

        // redis占位成功下单token前缀
        String MIAOSHA_SUCCESS_TOKEN_PREFIX = "MIAOSHA_SUCCESS_TOKEN_MOBILE";

        // redis库存
        String REDIS_GOODS_STORE = "REDIS_GOODS_STORE_GOODS_RANDOM_NAME:{0}";
    }

    /**
     * key过期时间
     */
    public interface RedisKeyExpireSeconds {
        int GOODS_STORE_BY_ID = 3 * 24 * 60 * 60;
    }

    /**
     * 限流倍数
     *
     * @author xiangyong.ding@weimob.com
     * @category 限流倍数
     * @since 2017年3月16日 下午2:08:54
     */
    public interface CurrentLimitMultiple {
        // 商品购买限流倍数
        int GOODS_BUY = 1;
    }

    /**
     * token有效期，单位：毫秒
     */
    public static final long TOKEN_EFECTIVE_MILLISECONDS = 10000;
}
